Automatically Deploying REST API Application with PowerShell Script

This section describes how to automatically create an Azure registration for connecting to the Live Platform through REST API.

This procedure requires the PowerShell script 'CreateAPITokenAppReg.ps1' (contact AudioCodes support for details)).
For script troubleshooting, see Script Troubleshooting.
To create registration:
1. Copy the CreateAPITokenAppReg.ps1 script to the desired location on your PC.
2. Open a Windows PowerShell ISE console as Administrator.

3. In the top pane, copy the following:
Copy
$msTenantID = 'xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

$Adminuser = 'admin@xxxx.onmicrosoft.com'

$Adminpass = ‘xxxxxx'

$appName = "LiveCloud-APIToken-xxxx"

 

&./CreateAPITokenAppReg.ps1 -msTenantID $msTenantID -Adminuser $Adminuser -Adminpass $Adminpass -appName $appName 
4. Change the credentials of the Service Provider Azure tenant subscription as follows (see Extracting Azure Tenant Subscription):
msTenantID
Adminuser
Adminpass
appName (enter LiveCloud-APIToken-<CustomFreeText>)

5. Change directory to the location where you saved the script "CreateAPITokenAppReg.ps1":
cd "<Directory Location of script>" 
6. On the PowerShell ISE Toolbar, click button to run the script.

During the script run, the following message may appear; the missing component is automatically installed and the script run continues.

At the end of the script, the following messages are displayed (including the output parameter categories):

7. Copy the following output parameters from the Console screen above to notepad (these parameters are required for connecting the REST API client to the Live Platform in Establish REST API client-Live Cloud Server Connection):
Tenant ID
Application (Client) ID
App (client) Secret
8. Login to the Azure portal for the Service Provider tenant with Global admin permissions.
9. Navigate to App registrations to view the newly created registration.

10. Click LiveCloud-APIToken-<Custom> to open the registration.
11. In the Overview page, view the details of the registration. Note the matching values for Application (client) ID and Directory (tenant) ID with those values displayed in the PowerShell console above.

12. In the Navigation pane, select API Permissions.

13. Click the Grant admin consent for Contoso check box.
14. On the Live Cloud server, open the SQL Database, SysadminTenant -> ApplicationSetting table, and then add the following parameters with the values shown below:
AzureAdJwt.ClientId = 9d576dc4-b85d-4571-880e-4c6ed4c08c31
AzureAdJwt.Domain = audiocodessaas.onmicrosoft.com
AzureAdJwt.TenantId = 36bc587e-514a-465c-ae90-2c7b99535f8f
AzureAdJwt.ValidIssuers = ["https://sts.windows.net/ <ServiceProviderAzureTenantID>"] where <ServiceProviderAzureTenantID> is the Direc tory (tenant) ID shown in the figure above.
15. Restart the UMP IIS Service.
16. Proceed to Establish REST API client-Live Cloud Server Connection.